Add BaseOutputPath to common targets#5238
Add BaseOutputPath to common targets#5238rainersigwald merged 7 commits intodotnet:masterfrom Nirmal4G:patch-1
Conversation
|
I don't know who to tag. So, @rainersigwald NuGet Pack target needs this. Can you or anyone from the team take a look at this? |
rainersigwald
left a comment
There was a problem hiding this comment.
Team triage: we're amenable in theory to taking this in 16.7/SDK 3.1.400.
rainersigwald
left a comment
There was a problem hiding this comment.
I appear to have written up comments but not published them. Sorry!
|
Did a little bit of refactoring to place all the output logic in one place. Other than that, only changes include what you have suggested: Using Should I add tests for the |
|
I think this looks good to go (with the minor changes that are outstanding). Would you mind resolving conflicts? |
|
When I tested the above logic with and without Common targets, there's a noticeable difference of around 700ms-1s delay when using property functions. This is observed with running the test project again and again in Command Prompt and WSL manually. Is there any guide/tool to properly profile MSBuild builds? I have tested the above logic with
The Behaviour of
|
That's a shockingly large difference. Can you share exactly how you were testing?
We have a fairly detailed evaluation-time profiler, and can also use our ETW events.
The results you shared don't make any sense to me, no. Again, can you describe exactly how you got them? |
|
Here's the test projects with different variations of OutputPath definitions: MSBuild-5238-Repro.zip With both Desktop and Core MSBuild run the test projects with As you have suggested, we can also profile them with or without Common targets using |
|
Without having looked too carefully, does this also resolve #2308? |
rainersigwald
left a comment
There was a problem hiding this comment.
I need to look at the tests but other than the comments about "MPFProj" that I need clarification on this is looking good. Thanks for your patience!
While this is not officially supported on non-sdk projects, NuGet Pack targets need a common output path to put '.nupkg' across both type of projects
Replace 'HasTrailingSlash' conditional function with '[MSBuild]::EnsureTrailingSlash' property function Replace '[System.IO.Path]::Combine' property function with '[MSBuild]::NormalizePath' and '[MSBuild]::NormalizeDirectory' property functions
when using OutputPath without BaseOutputPath
…bine paths Usually, either '[MSBuild]::NormalizePath' or '[MSBuild]::NormalizeDirectory' property functions would be preferred for these cases. But, there's a bug (on Windows) which occurs when a drive relative path like 'C:Projects' is specified and it fails to return to the project directory. Usually, '[System.IO.Path]::Join' would be most preferred in this context. But, it's not available in NETFX. So, '[System.IO.Path]::Combine' is used instead.
Making sure that existing 'OutputPath' scenarios work, while allowing the use of 'BaseOutputPath' property
Adjust the wording to make it simple, brief and clear. Co-Authored-By: Rainer Sigwald <raines@microsoft.com> > Fixup with original commit when this patch is approved.
Silly ME! There were a lot of build errors from the Fakes targets. I was banging my head on which change caused this but finally found it. Guess being sick has its perks.
|
@rainersigwald Sorry for the late reply!
|
I'm fine now. Thanks! |
|
Finally! 🥳 |
While this is not officially supported on non-sdk projects, NuGet Pack targets need a common output path to put '.nupkg' across both type of projects.
Required for NuGet/Home#9234 in PR NuGet/NuGet.Client#3270
Also Fixes #1664